<template>
    <!-- 重置密码dialog -->
    <el-dialog title="重置密码" :visible.sync="visible" width="20%">
      <p class="tootips">重置后，默认密码为123456</p>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handelCancel">关 闭</el-button>
        <el-button type="primary" @click="handleSubmit" v-if="tableType == '0'"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </template>
  <script>
  import { updateUser } from "@/api/system/user";
  import QuickFilterDate from "@/components/QuickFilterDate";
  import { inventoryRecord, addInventory } from "@/api/service/inventory";
  export default {
    components: {
      QuickFilterDate,
    },
    data() {
      return {
        tableType: "0",
        initObj: {},
        visible: false,
        changeForm: {
          kc: "",
        },
        rules: {
          kc: [
            {
              required: true,
              message: "请输入",
              trigger: "change",
            },
          ],
        },
  
        dialogVisible: false,
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 排班管理表格数据
        teamList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 价格表单
        priceForm: {},
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          type: "1",
          startTime: null,
          endTime: null,
          supplierName: null,
          concreteId: null,
          engineeringName: null,
        },
        times: [],
        // 表单参数
        form: {},
        // 表单校验
        rules: {},
      };
    },
    props: {},
    computed: {},
    methods: {
      handelChangeType(val) {
        if (val == "1") {
          this.resetQuery();
        }
      },
      // 初始化函数--->父级调用
      handelInit(val) {
        console.log(val);
        this.initObj = val;
        this.visible = true;
        this.queryParams.id = val.id;
        this.getList();
      },
      handelCancel() {
        this.visible = false;
      },
      //
      handleSubmit() {
        this.$refs.form.validate((valid) => {
          if (valid) {
            this.handleValidateSuccess();
          } else {
            return false;
          }
        });
      },
      handleValidateSuccess() {
        addInventory({
          ...this.formModel,
        }).then((res) => {
          console.log(res);
          this.handelCancel();
        });
      },
      /** 查询排班管理列表 */
      getList() {
        this.loading = true;
        inventoryRecord({
          ...this.queryParams,
        }).then((response) => {
          console.log("response--->", response);
          let { records, total } = response.data;
          this.teamList = records;
          this.total = total;
          this.loading = false;
        });
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
    },
  };
  </script>
    <style scoped lang="scss">
  .tootips {
    font-size: 16px;
    padding-left: 16px;
  }
  </style>